|
1
|
|
|
var table_helper = { |
|
2
|
|
|
IePrior: function(v){ |
|
3
|
|
|
var rv = false; |
|
4
|
|
|
if(window.navigator.appName === 'Microsoft Internet Explorer'){ |
|
5
|
|
|
var ua = window.navigator.userAgent; |
|
6
|
|
|
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); |
|
7
|
|
|
if(re.exec(ua) !== null){ |
|
8
|
|
|
rv = parseFloat(RegExp.$1); |
|
9
|
|
|
} |
|
10
|
|
|
rv = rv < v ? true : false; |
|
11
|
|
|
} |
|
12
|
|
|
return rv; |
|
13
|
|
|
}, |
|
14
|
|
|
GetParent: function(obj, objType){ |
|
15
|
|
|
while(obj && obj.tagName !== objType.toUpperCase()){ |
|
16
|
|
|
obj = obj.parentNode; |
|
17
|
|
|
} |
|
18
|
|
|
return obj; |
|
19
|
|
|
}, |
|
20
|
|
|
ProcessPaginationLinks: function(tfoot){ |
|
21
|
|
|
var pLinks = tfoot.querySelectorAll(".paging a"); |
|
22
|
|
|
if(pLinks.length > 0){ |
|
23
|
|
|
for(var j = 0; j < pLinks.length; j++){ |
|
24
|
|
|
pLinks[j].setAttribute("href", "javascript:void(0);"); |
|
25
|
|
|
pLinks[j].setAttribute("onclick", "return table.GoPage(this);"); |
|
26
|
|
|
} |
|
27
|
|
|
} |
|
28
|
|
|
}, |
|
29
|
|
|
RequestToUrl: function(rq){ |
|
30
|
|
|
var url = location.pathname + ".json" + location.search; |
|
31
|
|
|
if(typeof rq === "object"){ |
|
32
|
|
|
var getUrlVarName = { |
|
33
|
|
|
colNo: "col", colOrd: "ord", filter: "filter", |
|
34
|
|
|
filterBy: "filter-by", pageNo: "pg", exportType: "export", |
|
35
|
|
|
tableId: "table-id" |
|
36
|
|
|
}; |
|
37
|
|
|
var flagFirst = location.search.length < 1 ? true : false; |
|
38
|
|
|
for(var r in rq){ |
|
|
|
|
|
|
39
|
|
|
var clue = flagFirst === true ? "?" : "&"; |
|
40
|
|
|
url += clue + getUrlVarName[r] + "=" + rq[r]; |
|
41
|
|
|
flagFirst = false; |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
return url; |
|
45
|
|
|
}, |
|
46
|
|
|
RqObject: function(tableId){ |
|
47
|
|
|
var rq = {}; |
|
48
|
|
|
rq.tableId = tableId; |
|
49
|
|
|
rq.strDesc = this.strDesc; |
|
50
|
|
|
rq.strAsc = this.strAsc; |
|
51
|
|
|
return rq; |
|
52
|
|
|
} |
|
53
|
|
|
}; |
|
54
|
|
|
|
When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically: